﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NextCMS.DataAccess
{
    public class Entities
    {
        public static object CreateInstance<T>()
        {
            Type type = typeof(T);
           
            switch (type.FullName)
            {
                case "NextCMS.Models.ISite":
                    return new NextCMS.DataAccess.XMLDataAccess.Sites();
                case "NextCMS.Models.ITemplate":
                    return new NextCMS.DataAccess.XMLDataAccess.Templates();
                case "NextCMS.Models.IModules":
                    return new NextCMS.DataAccess.XMLDataAccess.Modules();
                case "NextCMS.Models.IPageContent":
                    return new NextCMS.DataAccess.XMLDataAccess.PageContents();
                case "NextCMS.Models.IPageForm":
                    return new NextCMS.DataAccess.XMLDataAccess.PageForms();
                case "NextCMS.Models.IPage":
                    return new NextCMS.DataAccess.XMLDataAccess.Pages();
                case "NextCMS.Models.IPageModule":
                    return new NextCMS.DataAccess.XMLDataAccess.PageModules();
                case "NextCMS.Models.ISiteSettings":
                    return new NextCMS.DataAccess.XMLDataAccess.SiteSettings();
                case "NextCMS.Models.ISiteLanguage":
                    return new NextCMS.DataAccess.XMLDataAccess.SiteLanguages();
                case "NextCMS.Models.ISiteResource":
                    return new NextCMS.DataAccess.XMLDataAccess.SiteResources();
                default:
                    return default(T);
            }
        }
    }
}
